package com.polytech.ihm;

import java.awt.FlowLayout;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.management.loading.PrivateClassLoader;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.polytech.beans.Car;

public class FrameCarInformation extends JFrame implements WindowListener{
	
	private PanelPicture panelPicture=new PanelPicture(500, 500, PanelPicture.DEFINESIZE);
	private JLabel information=new JLabel();
	private JPanel pan=new JPanel(new FlowLayout(FlowLayout.LEFT));
	public FrameCarInformation() {
		pan.add(panelPicture);
		panelPicture.setBorder(BorderFactory.createBevelBorder(0));
		pan.add(information);
		this.add(pan);
		this.pack();
	}
	
	public void show(Car car){
		information.setText(car.getAllInformation());
		panelPicture.setPicture(car.getPicture());
		this.toFront();
		this.pack();
		this.setVisible(true);
		
	}
	public void hide(){
		super.hide();
	}

	@Override
	public void windowActivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosed(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosing(WindowEvent e) {
		hide();
		
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowIconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowOpened(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}
	
	
	

}
